﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.SysManage;
using LJX.SmartPark.Service.SysManage;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.SysManage.UserManageServeice;

namespace LJX.SmartPark.WebApi.Controllers.SysManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "SysManage")]
    public class UserManageController : ControllerBase
    {
        private readonly IUserManageServeice _userManageServeice;

        public UserManageController(IUserManageServeice userManageServeice)
        {
            _userManageServeice = userManageServeice;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        [HttpDelete]
        public Task<Response<bool>> DeleteUserManage(UserManage input)
        {
            var result = _userManageServeice.DeleteUserManageAsync(input);
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdateUserManage(UserManage input)
        {
            var result = _userManageServeice.PutUpdUserManageAsync(input);

            return result;

        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _userManageServeice.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<UserManage>> GetUserManageAsync(FyUserManage fyUserManage)
        {
            var result = _userManageServeice.GetUserManageAsync(fyUserManage);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<UserManage> GetUserManageById(UserManage input)
        {
            var result = _userManageServeice.GetUserManageById(input);
            return result;
        }
    }
}
